// -------------------------AUTORUN-------------------------------------
if (hasInterface) then {
	waitUntil {
		!isNull findDisplay 46
	};
	(findDisplay 46) displayAddEventHandler ["KeyDown", {
		params ["_displayCode", "_keyCode", "_isShift", "_isCtrl", "_isAlt"];
		if (_this select 1 == (actionKeys 'uavView') select 0 && !_isAlt) then {
				if (isNil "AR_active") then {
					AR_active = false
				};
				if (AR_active) exitWith {
					AR_active = false
				};
				if (!isNull objectParent player) exitWith {};
				if (surfaceIsWater (getPos player)) exitWith {};
				AR_active = true;
				AR_weapon = currentWeapon player;
				AR_animation = switch (true) do {
					case (AR_weapon isEqualTo ""): {
						"AmovPercMevaSnonWnonDf"
					};
					case (AR_weapon isEqualTo (handgunWeapon player)): {
						"AmovPercMevaSlowWpstDf"
					};
					case (AR_weapon isEqualTo (primaryWeapon player)): {
						"AmovPercMevaSlowWrflDf"
					};
					case (AR_weapon isEqualTo (secondaryWeapon player)): {
						"AmovPercMevaSlowWlnrDf"
					};
					default {
						"AmovPercMevaSnonWnonDf"
					};
				};
				player addEventHandler ["AnimDone", {
					if ((!AR_active) || {
						!((currentWeapon player) isEqualTo AR_weapon)
					} ||
					{
						!isNull objectParent player
					} || {
						surfaceIsWater (getPos player)
					} ||
					{
						_this select 1 == AR_animation && speed (vehicle player) <= 0
					}) exitWith {
						player removeEventHandler ["AnimDone", _thisEventHandler];
						AR_active = false;
						AR_weapon = nil;
						AR_animation = nil;
					};
					player playMoveNow AR_animation;
				}];
				player playMoveNow AR_animation;
			};
		}];
		// 停止奔跑
		(findDisplay 46) displayAddEventHandler ["KeyDown", {
			if ((_this select 1 == (actionKeys 'MoveForward') select 0)
			|| (_this select 1 == (actionKeys 'vehicleTurbo') select 0)
			|| (_this select 1 == (actionKeys 'uavView') select 0)
			|| (_this select 1 == (actionKeys 'MoveBack') select 0)
			|| (_this select 1 == (actionKeys 'TurnRight') select 0)
			|| (_this select 1 == (actionKeys 'TurnLeft') select 0)
			|| (_this select 1 == (actionKeys 'MoveUp') select 0)) then {
				if (AR_active) then {
					AR_active = false
				};
			};
		}];
		systemChat "开启自动跑步功能，TAB键启用，ASDWX任意键取消动作。"
	};
	// -------------------------AUTORUN-------------------------------------